<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@taglib prefix="ah" uri="/WEB-INF/tags/utilTagLib.tld"%>
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="${res}/js/jquery/jquery.form.js"></script>
<script type="text/javascript" src="${res}/js/proposal/irisPrpPrepare.js"></script>
<script type="text/javascript" src="${res_app}/js/app/proposal/irisPrpPrepare.js"></script>
<script type="text/javascript" src="${res}/js/validate/irisvalidator.js"></script>
<title>
	<c:if test="${method_Get=='add'}">新增</c:if>
	<c:if test="${method_Get=='edit'}">编辑</c:if>
	限项
</title>
<%@ include file="/common/meta.jsp"%>
</head>
<body>
	<form id="mainForm" method="post" action="${ctx}/prpapprove/saveOrgRecommendLimit">
		<table width="100%" border="0" cellpadding="0" cellspacing="1" class="t_css" id="basic">
			<tr class="li_1">
				<td align="right" width="160">
					项目类别：
				</td>
				<td align="left"  width="160">
				    <span>${grantName}</span>
					<input type="hidden" id="grantType_value" class="input_css" name="id.grantCode" value="${id.grantCode}">
					<input type="hidden" id="grantType_name" name="grantName" value="${grantName}">
				</td>
				<td align="right">
					业务年度：
				</td>
				<td align="left">
				<span>${id.statYear}</span>
				   <input type="hidden"  name="id.statYear" value="${id.statYear}" />
				</td>
			</tr>
			<tr class="li_2">
				<td align="right" >
					归口管理部门：
				</td>
				<td align="left">
					 <span>${orgName}</span>
					<input type="hidden" id="recomend_org_value" name="id.orgCode" value="${id.orgCode}">
					<input type="hidden" id="recomend_org_name" name="orgName" value="${orgName}">
				</td>
				<td align="right" >
					申报批次：
				</td>
				<td align="left">
				 
					 <span><ah:const code="${id.batch}" category="batch"/></span>
                    <input type="hidden"  name="id.batch" value="${id.batch}">
				</td>
			</tr>
			<tr class="li_1">
				<td align="right" >
					<span class="color_red">*</span>
					设置上限：
				</td>
				<td align="left">
					<input type="text" class="input_css required valueGENum:limitNum:1" name="limitNum" id="limitNum" label="设置上限"
						value="${limitNum}" onfocus="InitInput.setNumber(this,11,0,0);" style="text-align:right;"/>
				</td>
				<td align="right"></td>
				<td align="left"></td>
			</tr>
		</table>
		</table>
	</form>
	<table width="100%" align="center">
		<tr>
			<td>
				<input class="button_01" type="button" value="提交" onclick="save();" id="save">
				<input class="button_01" type="button" value="返回" onclick="parent.tb_remove2();">
			</td>
		</tr>
	</table>
</body>
</html>
<script type="text/javascript">
	var prcWin = new progressWin("${res}"); //初始化遮罩层
	function save() {
		validate($("#basic"), "限项");
		if (!valResult()) {
			irisValShowMsg($("#save"));
			return false;
		}
		prcWin.openWin();//打开遮罩层
		$(":button,:submit").each(function() {//锁住按钮
			$(this).attr("disabled", "true");
		});
		var options = {
			success : function(msg) {
				prcWin.closeWin();
				if (msg != null && msg == "success") {//保存成功
					scmSuccess("保存成功", "100px");
					//parent.irisGrid2.getGridDom().jqGrid("refresh",0);
					parent.irisGrid.getGridDom().jqGrid("refresh", 0);
					window.setTimeout("parent.tb_remove();", 500);
				} else {
					scmError("保存失败", "100px");
					$(":button,:submit").each(function() { //打开按钮
						$(this).removeAttr("disabled");
					});
				}

			},// 表单成功提交后的回调函数
			error : function() {
				prcWin.closeWin();
				scmError("保存失败", "100px");
				$(":button,:submit").each(function() {//打开按钮
					$(this).removeAttr("disabled");
				});
			},
			dateType : 'text',
			type : "post" // 提交方式 post,get
		};

		$("#mainForm").ajaxSubmit(options);
	}

	function setValueById(name, obj, value) {
		var obj = $(obj);
		var nameId = name + "_name";
		var valueId = name + "_value";
		$("#" + nameId).val(obj.attr("name"));
		$("#" + valueId).val(obj.attr("id"));
	}

	function initTreeValueExt(treeId, treeNode) {
		
		if ((treeNode && treeNode.isParent)) {
			scmWarn("请选择具体的" + $("#" + treeId).attr("label"));
			
			$("#" + treeId).val("");
			$("#" + treeId).parents("td")
					.find(
							"[name$='" + treeId + "_code'],[id$='" + treeId
									+ "_code']").val("");
			$("#" + treeId).parents("td").find(
					"[name$='" + treeId + "_value'],[id$='" + treeId
							+ "_value']").val("");
			$("#" + treeId).parents("td")
					.find(
							"[name$='" + treeId + "_name'],[id$='" + treeId
									+ "_name']").val("");
			return false;
		}

		var str = treeNode.name;
		var obj = treeNode.parentNode;
		while (obj != null) {
			str = obj.name + "-" + str;
			obj = obj.parentNode;
		}

		//     initTitle(treeId);
		$("#" + treeId).parents("td").find(
				"[name$='" + treeId + "_code'],[id$='" + treeId + "_code']")
				.val(treeNode.id);
		$("#" + treeId).parents("td").find(
				"[name$='" + treeId + "_value'],[id$='" + treeId + "_value']")
				.val(treeNode.id);
		$("#" + treeId).parents("td").find(
				"[name$='" + treeId + "_name'],[id$='" + treeId + "_name']")
				.val(str);
	}
</script>